<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body><!-- 
	<input type="radio" id="r1" name="gender" value="aa" >
	<input type="radio" id="r2" name="gender" value="aa" >
	<select id="nation" class="nb1">
	    <option>请选择</option>
	    <option value="1" selected="selected">汉</option>
	    <option value="2">其它</option>
	</select>
	<select id="nation1" class="nb1" name="userNation">
	    <option>请选择</option>
	    <option id="special" value="1" selected="selected">汉</option>
	    <option value="2">其它</option>
	</select>
	<input type="button" id="btn" value="点我">
	<textarea id="txt" class="aaa"></textarea> -->
	<input type="text" id="good" autofocus>
	<div id="test" class="name" mydata="13865935707">aa
		<h3>这是3级标题</h3>bb<!--注释-->
		<p id="testp" name="testp">A</p>ccc
		<p class="testpclass">Test paragraph1</p>dd
		<p class="testpclass">Test paragraph2</p>ee
		<p class="testpclass">Test paragraph3</p>ff
	</div>
	<div id="test1">
		<h3>这是test1中的3级标题</h3>
		<p class="testpclass1">Test1 paragraph1</p>
		<p class="testpclass1">Test1 paragraph2</p>
		<p class="testpclass1">Test1 paragraph3</p>
	</div>
<script>
	function foo () {
		console.log('hello world'); 
	}
    var inputObj = document.getElementById('good');
    var divObj = document.getElementById('test');
    var hObj = document.createElement('h1');
    var paragraph = '这是标题';
    var textObj = document.createTextNode(paragraph);
    hObj.append(textObj);
    for (var i = 0; i < divObj.childNodes.length; i++) {
    	if(divObj.childNodes[i].nodeType==Node.COMMENT_NODE){
	    	console.log(divObj.childNodes[i]);
    	}
    }
    // hObj.appendChild(textObj);  添加子节点的另一种方法
   	divObj.insertBefore(hObj,divObj.firstChild);
   	// divObj.replaceChild(hObj,divObj.children[0]);
   	// var c = divObj.remove(divObj.children[5]);
   	// console.log(c);
    var divObj1 = document.getElementById('test1');
    // var a = divObj1.insertBefore(divObj.children[0],divObj1.children[0]);



</script>
</body>
</html>